<!DOCTYPE html>
<html>
<head th:include="common/header_css::header('霸王餐小程序后台管理-商品信息','%mfile%summernote')"></head>
<!--<head th:include="common/header_css::header('霸王餐小程序后台管理-商家管理-商户信息')"></head>-->
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div th:replace="common/toolbar::toolbar('商家基本信息管理')"></div>
        <div th:replace="common/search::search('%add')"></div>
        <!-- End Panel Basic -->
    </div>

    <!--添加Merchant模态框-->
    <div id="modal-add-form" class="modal fade" aria-hidden="true">
        <div class="modal-dialog" style="width: 800px;">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="row">
                        <h3 class="m-t-none m-b">商家添加</h3>
                        <div class="col-sm-12">
                            <div class="ibox float-e-margins">
                                <div class="ibox-content">
                                    <form id="aform" method="post" class="form-horizontal" action="add"
                                          onsubmit="return checkAdd()">
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">商户名称 *
                                                    </label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" name="name"
                                                               required
                                                               type="text" maxlength="100"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">商户编码 *
                                                    </label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" name="mcode"
                                                               required
                                                               type="text" maxlength="30"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">商户行业</label>
                                                    <div class="col-sm-8">
                                                        <select class="form-control" name="mtype">
                                                            <option value="">请选择</option>
                                                            <option th:each="item,userStat:${list}"
                                                                    th:value="${item.code}"
                                                                    th:text="${item.name}"></option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">启用状态*
                                                    </label>
                                                    <div class="col-sm-8">
                                                        <input type="checkbox" class="js-switch" name="state" value="1">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!--<div class="row">-->
                                        <!--<div class="col-md-6">-->
                                        <!--<div class="form-group">-->
                                        <!--<label class="col-sm-4 control-label">应用id*-->
                                        <!--</label>-->
                                        <!--<div class="col-sm-8">-->
                                        <!--<input class="form-control" name="appid"-->
                                        <!--required-->
                                        <!--type="text" maxlength="32"/>-->
                                        <!--</div>-->
                                        <!--</div>-->
                                        <!--</div>-->
                                        <!--<div class="col-md-6">-->
                                        <!--<div class="form-group">-->
                                        <!--<label class="col-sm-4 control-label">应用密钥*-->
                                        <!--</label>-->
                                        <!--<div class="col-sm-8">-->
                                        <!--<input class="form-control" name="appsecret"-->
                                        <!--required-->
                                        <!--type="text" maxlength="32"/>-->
                                        <!--</div>-->
                                        <!--</div>-->
                                        <!--</div>-->
                                        <!--</div>-->

                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">支付商户ID</label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" name="mchid"
                                                               type="text" maxlength="32"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">支付密钥</label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" name="paykey"
                                                               type="text" maxlength="50"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">商户logo *
                                                    </label>
                                                    <div class="col-sm-10">
                                                        <input id="mfile" name="mfile" type="file" class="file"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">商户简介*
                                                    </label>
                                                    <div class="col-sm-10">
                                                        <div id="sninfo"></div>
                                                        <input type="hidden" name="info"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-2">
                                                <button class="btn btn-primary" type="submit">保存内容</button>
                                                <button data-toggle="modal" type="button" class="btn btn-white"
                                                        href="#modal-add-form">取消
                                                </button>
                                            </div>
                                        </div>
                                        <input id="hidpic" name="pic" type="hidden" value="" required="required"/>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--修改Merchant模态框-->
    <div id="modal-form" class="modal fade" aria-hidden="true">
        <div class="modal-dialog" style="width: 800px;">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="row">
                        <h3 class="m-t-none m-b">商家修改</h3>
                        <div class="col-sm-12">
                            <div class="ibox float-e-margins">
                                <div class="ibox-content">
                                    <form id="mform" method="post" class="form-horizontal" action="modify"
                                          onsubmit="return checkModify()">
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">商户名称*
                                                    </label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" id="name" name="name"
                                                               required type="text" maxlength="100"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">商户编码*
                                                    </label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" id="mcode" name="mcode"
                                                               required type="text" maxlength="30"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">商户行业</label>
                                                    <div class="col-sm-8">
                                                        <select class="form-control" name="mtype" id="mtype">
                                                            <option value="">请选择</option>
                                                            <option th:each="item,userStat:${list}"
                                                                    th:value="${item.code}"
                                                                    th:text="${item.name}"></option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">启用状态*
                                                    </label>
                                                    <div class="col-sm-8">
                                                        <input type="checkbox" name="state" id="state" value="1">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">支付商户ID</label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" id="mchid" name="mchid"
                                                               type="text" maxlength="32"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="col-sm-4 control-label">支付密钥</label>
                                                    <div class="col-sm-8">
                                                        <input class="form-control" id="paykey" name="paykey"
                                                               type="text" maxlength="50"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">商户logo*
                                                    </label>
                                                    <div class="col-sm-10">
                                                        <input id="mfile2" name="mfile" type="file" class="file"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">商户简介*
                                                    </label>
                                                    <div class="col-sm-10">
                                                        <div id="sninfo2"></div>
                                                        <input type="hidden" id="info2" name="info"/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-2">
                                                <button class="btn btn-primary" type="submit">保存内容</button>
                                                <button data-toggle="modal" type="button" class="btn btn-white"
                                                        href="#modal-form">取消
                                                </button>
                                            </div>
                                        </div>
                                        <input id="hidpic2" name="pic" type="hidden" value="" required="required"/>
                                        <input id="id" name="id" type="hidden" value=""/>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div th:include="common/footer_js::footer"></div>
    <script src="/js/admin/merchant.js"></script>
    <input id="isAdmin" type="hidden" th:value="${isAdmin}"/>
</body>
</html>
<script th:inline="javascript">
    var pwd = [[${pwd}]], idu = [[${idu}]];
    if (idu && idu.length > 0) {
        swal({title: "商家信息提示", text: "商家后台登陆账号为：" + idu + "\n\r" + "商家后台登陆密码为：" + pwd, type: "success"})
    }
</script>
